import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import './assets/css/common.css'
import 'nprogress/nprogress.css'
import 'element-ui/lib/theme-chalk/index.css'
import './plugins/element'
//vue懒加载模块
import VueLazyload from 'vue-lazyload'
let errImg = require('./assets/img/error.jpg')
let loadingImg = require('./assets/img/loading.gif')
Vue.use(VueLazyload, {
  preLoad: 1,
  error: errImg,
  loading: loadingImg,
  attempt: 1,
})

Vue.config.productionTip = false

//全局的日期过滤器
Vue.filter('dateFormat', function (v) {
  v = v ? new Date(v) : new Date()
  let str = v.getFullYear() + '-'
  str += (v.getMonth() + 1 + '').padStart(2, '0') + '-'
  str += (v.getDate() + '').padStart(2, '0') + ' '
  str += (v.getHours() + '').padStart(2, '0') + ':'
  str += (v.getMinutes() + '').padStart(2, '0') + ':'
  str += (v.getSeconds() + '').padStart(2, '0')
  return str
})

new Vue({
  router,
  store,
  render: (h) => h(App),
}).$mount('#app')
